<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: /HElib/include/helib/fhe_stats.h Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_d0c4ae63660968bf6b1c77a1e8aecf95.html">helib</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">fhe_stats.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="fhe__stats_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/* Copyright (C) 2019-2020 IBM Corp.</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * This program is Licensed under the Apache License, Version 2.0</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * (the &quot;License&quot;); you may not use this file except in compliance</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> *   http://www.apache.org/licenses/LICENSE-2.0</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> * limitations under the License. See accompanying LICENSE file.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#ifndef HELIB_STATS_H</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#define HELIB_STATS_H</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160; </div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor">#include &lt;iostream&gt;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacehelib.html">helib</a> {</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html">   21</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structhelib_1_1fhe__stats__record.html">fhe_stats_record</a></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;{</div>
<div class="line"><a name="l00023"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html#a325de3da1835555db01795d3e7619628">   23</a></span>&#160;  <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="structhelib_1_1fhe__stats__record.html#a325de3da1835555db01795d3e7619628">name</a>;</div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html#aa545adda591425d7ef963c46b22bcfb1">   24</a></span>&#160;  <span class="keywordtype">long</span> <a class="code" href="structhelib_1_1fhe__stats__record.html#aa545adda591425d7ef963c46b22bcfb1">count</a>;</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html#aa3926cdfc0f7b6f1878eb2e5a09507d7">   25</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="structhelib_1_1fhe__stats__record.html#aa3926cdfc0f7b6f1878eb2e5a09507d7">sum</a>;</div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html#a31cd2ae2efc75dbe22dca31d26ab3b2b">   26</a></span>&#160;  <span class="keywordtype">double</span> <a class="code" href="structhelib_1_1fhe__stats__record.html#a31cd2ae2efc75dbe22dca31d26ab3b2b">max</a>;</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html#ae21812b61d7cae29b086c7514739859e">   28</a></span>&#160;  std::vector&lt;double&gt; <a class="code" href="structhelib_1_1fhe__stats__record.html#ae21812b61d7cae29b086c7514739859e">saved_values</a>;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;  <span class="comment">// save all values --- only used if explicitly requested</span></div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160; </div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="structhelib_1_1fhe__stats__record.html#a64be4cf8d7bde9a86a6977d393827a99">   31</a></span>&#160;  <span class="keyword">static</span> std::vector&lt;fhe_stats_record*&gt; <a class="code" href="structhelib_1_1fhe__stats__record.html#a64be4cf8d7bde9a86a6977d393827a99">map</a>;</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;  <a class="code" href="structhelib_1_1fhe__stats__record.html#ae2fc4abce27244f9dd0270909b56458d">fhe_stats_record</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* _name);</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="structhelib_1_1fhe__stats__record.html#acf6ecef5241f43dd080290179dcbc81e">update</a>(<span class="keywordtype">double</span> val);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;  <span class="keywordtype">void</span> <a class="code" href="structhelib_1_1fhe__stats__record.html#a9ffbfb3b5f20f62df01cfdae4c42e924">save</a>(<span class="keywordtype">double</span> val);</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;};</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#define HELIB_STATS_UPDATE(name, val)                                          \</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="fhe__stats_8h.html#a3b829daf91681192beaed38a7b449a5f">   39</a></span>&#160;<span class="preprocessor">  do {                                                                         \</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor">    if (fhe_stats) {                                                           \</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor">      static fhe_stats_record _local_stats_record(name);                       \</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="preprocessor">      _local_stats_record.update(val);                                         \</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">    }                                                                          \</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="preprocessor">  } while (0)</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160; </div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="preprocessor">#define HELIB_STATS_SAVE(name, val)                                            \</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="fhe__stats_8h.html#a974fef7510d9f8dfb5e9d433380f5628">   47</a></span>&#160;<span class="preprocessor">  do {                                                                         \</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="preprocessor">    if (fhe_stats) {                                                           \</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="preprocessor">      static fhe_stats_record _local_stats_record(name);                       \</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="preprocessor">      _local_stats_record.save(val);                                           \</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">    }                                                                          \</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor">  } while (0)</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keywordtype">void</span> <a class="code" href="namespacehelib.html#a14bd686a2e209597f3acecd89f1a3520">print_stats</a>(std::ostream&amp; s);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160; </div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="keyword">const</span> std::vector&lt;double&gt;* <a class="code" href="namespacehelib.html#af35e417bff539eb8c29da182c8365e41">fetch_saved_values</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>*);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160; </div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">bool</span> <a class="code" href="namespacehelib.html#a43b6a65490d657b3d2b631fb1fe423e8">fhe_stats</a>;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160; </div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;} <span class="comment">// namespace helib</span></div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_ae21812b61d7cae29b086c7514739859e"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#ae21812b61d7cae29b086c7514739859e">helib::fhe_stats_record::saved_values</a></div><div class="ttdeci">std::vector&lt; double &gt; saved_values</div><div class="ttdef"><b>Definition:</b> fhe_stats.h:28</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_aa3926cdfc0f7b6f1878eb2e5a09507d7"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#aa3926cdfc0f7b6f1878eb2e5a09507d7">helib::fhe_stats_record::sum</a></div><div class="ttdeci">double sum</div><div class="ttdef"><b>Definition:</b> fhe_stats.h:25</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_a64be4cf8d7bde9a86a6977d393827a99"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#a64be4cf8d7bde9a86a6977d393827a99">helib::fhe_stats_record::map</a></div><div class="ttdeci">static std::vector&lt; fhe_stats_record * &gt; map</div><div class="ttdef"><b>Definition:</b> fhe_stats.h:31</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_acf6ecef5241f43dd080290179dcbc81e"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#acf6ecef5241f43dd080290179dcbc81e">helib::fhe_stats_record::update</a></div><div class="ttdeci">void update(double val)</div><div class="ttdef"><b>Definition:</b> fhe_stats.cpp:34</div></div>
<div class="ttc" id="anamespacehelib_html_a43b6a65490d657b3d2b631fb1fe423e8"><div class="ttname"><a href="namespacehelib.html#a43b6a65490d657b3d2b631fb1fe423e8">helib::fhe_stats</a></div><div class="ttdeci">bool fhe_stats</div><div class="ttdef"><b>Definition:</b> fhe_stats.cpp:21</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_aa545adda591425d7ef963c46b22bcfb1"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#aa545adda591425d7ef963c46b22bcfb1">helib::fhe_stats_record::count</a></div><div class="ttdeci">long count</div><div class="ttdef"><b>Definition:</b> fhe_stats.h:24</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_a325de3da1835555db01795d3e7619628"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#a325de3da1835555db01795d3e7619628">helib::fhe_stats_record::name</a></div><div class="ttdeci">const char * name</div><div class="ttdef"><b>Definition:</b> fhe_stats.h:23</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html">helib::fhe_stats_record</a></div><div class="ttdef"><b>Definition:</b> fhe_stats.h:22</div></div>
<div class="ttc" id="anamespacehelib_html_a14bd686a2e209597f3acecd89f1a3520"><div class="ttname"><a href="namespacehelib.html#a14bd686a2e209597f3acecd89f1a3520">helib::print_stats</a></div><div class="ttdeci">void print_stats(std::ostream &amp;s)</div><div class="ttdef"><b>Definition:</b> fhe_stats.cpp:54</div></div>
<div class="ttc" id="anamespacehelib_html_af35e417bff539eb8c29da182c8365e41"><div class="ttname"><a href="namespacehelib.html#af35e417bff539eb8c29da182c8365e41">helib::fetch_saved_values</a></div><div class="ttdeci">const std::vector&lt; double &gt; * fetch_saved_values(const char *)</div><div class="ttdef"><b>Definition:</b> fhe_stats.cpp:70</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_a9ffbfb3b5f20f62df01cfdae4c42e924"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#a9ffbfb3b5f20f62df01cfdae4c42e924">helib::fhe_stats_record::save</a></div><div class="ttdeci">void save(double val)</div><div class="ttdef"><b>Definition:</b> fhe_stats.cpp:43</div></div>
<div class="ttc" id="anamespacehelib_html"><div class="ttname"><a href="namespacehelib.html">helib</a></div><div class="ttdef"><b>Definition:</b> apiAttributes.h:21</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_ae2fc4abce27244f9dd0270909b56458d"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#ae2fc4abce27244f9dd0270909b56458d">helib::fhe_stats_record::fhe_stats_record</a></div><div class="ttdeci">fhe_stats_record(const char *_name)</div><div class="ttdef"><b>Definition:</b> fhe_stats.cpp:26</div></div>
<div class="ttc" id="astructhelib_1_1fhe__stats__record_html_a31cd2ae2efc75dbe22dca31d26ab3b2b"><div class="ttname"><a href="structhelib_1_1fhe__stats__record.html#a31cd2ae2efc75dbe22dca31d26ab3b2b">helib::fhe_stats_record::max</a></div><div class="ttdeci">double max</div><div class="ttdef"><b>Definition:</b> fhe_stats.h:26</div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
